]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: prevent blink of current app indicator
authorMaxim Ermilov <zaspire@rambler.ru>
Tue, 8 Mar 2011 17:46:43 +0000 (20:46 +0300)
committerMaxim Ermilov <zaspire@rambler.ru>
Tue, 8 Mar 2011 22:53:32 +0000 (01:53 +0300)
If new current app is null, show animation of disappearing old.
https://bugzilla.gnome.org/show_bug.cgi?id=615099

js/ui/panel.js

index 3894539f084fb6f123d8ff8a624c452b61ef71e0..c08c3e8344e8cdbacf66dd46b1dd6d047b68a352 100644 (file)
@@ -244,6 +244,10 @@ AppMenuButton.prototype = {
 
         let bin = new St.Bin({ name: 'appMenu' });
         this.actor.set_child(bin);
+
+        this.actor.reactive = false;
+        this._targetIsCurrent = false;
+
         this._container = new Shell.GenericContainer();
         bin.set_child(this._container);
         this._container.connect('get-preferred-width', Lang.bind(this, this._getContentPreferredWidth));
@@ -501,13 +505,6 @@ AppMenuButton.prototype = {
                 lastStartedApp = this._startingApps[i];
 
         let focusedApp = tracker.focus_app;
-        let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
-        if (targetApp == this._targetApp) {
-            if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
-                this.stopAnimation();
-            return;
-        }
-        this._stopAnimation();
 
         if (!focusedApp) {
             // If the app has just lost focus to the panel, pretend
@@ -517,27 +514,56 @@ AppMenuButton.prototype = {
                 return;
         }
 
+        let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
+
+        if (targetApp == null) {
+            if (!this._targetIsCurrent)
+                return;
+
+            this.actor.reactive = false;
+            this._targetIsCurrent = false;
+
+            Tweener.removeTweens(this.actor);
+            Tweener.addTween(this.actor, { opacity: 0,
+                                           time: Overview.ANIMATION_TIME,
+                                           transition: 'easeOutQuad' });
+            return;
+        }
+
+        if (!this._targetIsCurrent) {
+            this.actor.reactive = true;
+            this._targetIsCurrent = true;
+
+            Tweener.removeTweens(this.actor);
+            Tweener.addTween(this.actor, { opacity: 255,
+                                           time: Overview.ANIMATION_TIME,
+                                           transition: 'easeOutQuad' });
+        }
+
+        if (targetApp == this._targetApp) {
+            if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
+                this.stopAnimation();
+            return;
+        }
+        this._stopAnimation();
+
         if (this._iconBox.child != null)
             this._iconBox.child.destroy();
         this._iconBox.hide();
         this._label.setText('');
-        this.actor.reactive = false;
 
         this._targetApp = targetApp;
-        if (targetApp != null) {
-            let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
+        let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
 
-            this._label.setText(targetApp.get_name());
-            // TODO - _quit() doesn't really work on apps in state STARTING yet
-            this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
+        this._label.setText(targetApp.get_name());
+        // TODO - _quit() doesn't really work on apps in state STARTING yet
+        this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
 
-            this.actor.reactive = true;
-            this._iconBox.set_child(icon);
-            this._iconBox.show();
+        this._iconBox.set_child(icon);
+        this._iconBox.show();
 
-            if (targetApp.get_state() == Shell.AppState.STARTING)
-                this.startAnimation();
-        }
+        if (targetApp.get_state() == Shell.AppState.STARTING)
+            this.startAnimation();
 
         this.emit('changed');
     }